#!/usr/bin/python3
# -*- coding: UTF-8 -*-
"""
格式化输出
"""
import reprlib
# reprlib 模块提供一个定制化版本的 repr() 函数，用于缩略显示大型或深层嵌套的容器对象
print(reprlib.repr(set('suppercalifragilisticexptialidocious')))
import pprint
t = [[[['black', 'cyan'], 'white', ['green', 'red']], [['magenta',
     'yellow'], 'blue']]]
pprint.pprint(t, width=30)
# textwrap  模块能够格式化本文段落，以适应给定的屏幕宽度
import textwrap
doc = """The wrap() method is just like fill() except that it returns
a list of strings instead of one big string with newlines to separate
 the wrapped lines."""
print(textwrap.fill(doc, width=40))
import locale
# print(locale.setlocale(locale.LC_ALL, 'English_United States.1252'))
conv = locale.localeconv()
x = 1234567.8
locale.format("%d", x, grouping=True)
locale.format_string("%s%.*f", (conv['currency_symbol'],
                      conv['frac_digits'], x), grouping=True)
